﻿CREATE TABLE [dbo].[core_navigation] (
    [Id]            UNIQUEIDENTIFIER NOT NULL,
    [Code]          NVARCHAR (MAX)   NULL,
    [SiteId]        UNIQUEIDENTIFIER NOT NULL,
    [PageId]        UNIQUEIDENTIFIER NULL,
    [ImageId]       UNIQUEIDENTIFIER NULL,
    [ParentId]      UNIQUEIDENTIFIER NULL,
    [Caption]       NVARCHAR (MAX)   NULL,
    [Description]   NVARCHAR (MAX)   NULL,
    [TargetType]    NVARCHAR (MAX)   NULL,
    [TargetId]      UNIQUEIDENTIFIER NULL,
    [Url]           NVARCHAR (MAX)   NULL,
    [Arguments]     NVARCHAR (MAX)   NULL,
    [ContainerCode] NVARCHAR (MAX)   NULL,
    [SortIndex]     INT              NOT NULL,
    CONSTRAINT [PK_dbo.core_navigation] PRIMARY KEY NONCLUSTERED ([Id] ASC),
    CONSTRAINT [FK_dbo.core_navigation_dbo.core_navigation_ParentId] FOREIGN KEY ([ParentId]) REFERENCES [dbo].[core_navigation] ([Id])
);


GO
CREATE NONCLUSTERED INDEX [IX_ParentId]
    ON [dbo].[core_navigation]([ParentId] ASC);

